Skip to content

Conversation

@JerryWu1234
Copy link
Contributor

…ping

what changed

  • Removed the old modelToProviderMap and replaced it with the new MODEL_PROVIDER_MAP for better maintainability and clarity.
  • Updated the LLMProvider class to utilize the new mapping, ensuring consistent handling of model names and providers.

test plan

  • Ensure existing functionality remains intact by running all relevant tests and verifying no regressions occur.

why

what changed

test plan

…ping

# what changed
- Removed the old modelToProviderMap and replaced it with the new MODEL_PROVIDER_MAP for better maintainability and clarity.
- Updated the LLMProvider class to utilize the new mapping, ensuring consistent handling of model names and providers.

# test plan
- Ensure existing functionality remains intact by running all relevant tests and verifying no regressions occur.
@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

🦋 Changeset detected

Latest commit: a7e65c1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@browserbasehq/stagehand Patch
@browserbasehq/stagehand-evals Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 18, 2025

Greptile Summary

  • Refactored model-to-provider mapping by moving MODEL_PROVIDER_MAP from LLMProvider to public types for better reusability and maintainability
  • Introduced KnownModel type to distinguish between known models in the map and arbitrary string models

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The refactoring is straightforward and maintains existing behavior by simply moving the mapping to a more appropriate location without changing any logic
  • No files require special attention

Important Files Changed

Filename Overview
packages/core/lib/v3/types/public/model.ts Moved MODEL_PROVIDER_MAP from LLMProvider to be exported, added KnownModel type, updated AvailableModel to reference KnownModel
packages/core/lib/v3/llm/LLMProvider.ts Removed local modelToProviderMap and imported MODEL_PROVIDER_MAP from model types, updated references to use imported constant

Sequence Diagram

sequenceDiagram
    participant User
    participant LLMProvider
    participant MODEL_PROVIDER_MAP
    participant Client
    
    User->>LLMProvider: "getClient(modelName)"
    LLMProvider->>LLMProvider: "Check if modelName contains '/'"
    alt AISDK model (contains '/')
        LLMProvider->>LLMProvider: "Parse provider and model"
        LLMProvider->>Client: "Return AISdkClient"
    else Known model
        LLMProvider->>MODEL_PROVIDER_MAP: "Lookup modelName as KnownModel"
        MODEL_PROVIDER_MAP-->>LLMProvider: "Return provider"
        LLMProvider->>Client: "Return provider-specific client (OpenAI/Anthropic/etc)"
    end
    Client-->>User: "LLMClient instance"
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile
React with 👍 or 👎 to share your feedback on this new summary format

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant